<template>
  <div class="mine">
    <div class="my-header">
      <div class="my_headers">
        <van-image
          round
          width="1.5rem"
          height="1.5rem"
          src="https://img01.yzcdn.cn/vant/cat.jpeg"
        />
        <p v-if="!flag"  @click="cell_login">登录</p>
        <p v-else>{{text}}</p>
      </div>
    </div>
    <div class="my_dingdan">
      <div>
        <img src="../../public/订单.png" alt="" />
        <p>演出订单</p>
      </div>
      <div>
        <img src="../../public/众筹.png" alt="" />
        <p>众筹订单</p>
      </div>
      <div>
        <img src="../../public/周边.png" alt="" />
        <p>周边订单</p>
      </div>
    </div>
    <div class="cell">
      <van-cell-group>
        <van-cell title="实名认证" is-link :clickable="false" />
      </van-cell-group>
      <van-cell-group>
        <van-cell title="收货地址" is-link :clickable="false" />
      </van-cell-group>
      <van-cell-group>
        <van-cell title="常用观演人" is-link :clickable="false" />
      </van-cell-group>
      <van-cell-group>
        <van-cell title="优惠券" is-link :clickable="false" />
      </van-cell-group>
    </div>
    <div class="cell_bottom">
      <van-cell-group>
        <van-cell title="客服电话 400-188-6980" is-link :clickable="false" />
      </van-cell-group>
    </div>
      <div class="quit_login">
      <van-cell-group>
        <van-cell title="退出登录" v-show="flag"  is-link :clickable="false" @click="quit_login"/>
      </van-cell-group>
    </div>
    <tabbars></tabbars>
  </div>
</template>

<script>
import tabbars from "../components/Tabbars.vue"
export default {
  name: "Mine",
  props: {},
  inject:['reload'],
  data() {
    return {
        flag:false,
        text:''
    };
  },
  computed: {},
  created() {
      console.log(localStorage.getItem('token'))
      if(localStorage.getItem('token')){
          this.flag=true
          this.text=localStorage.getItem('token')
      }else{
          this.flag=false
      }
  },
  mounted() {},
  watch: {},
  methods: {
      cell_login(){
          this.$router.push({
              path:'/login',
              query:{
                  name:'/mine'
              }
          })
      },
      quit_login(){
        localStorage.removeItem('token')
        // this.$router.go(0)
          this.reload()
      }
  },
  components: {
    tabbars
  },
};
</script>

<style scoped lang="less">
.mine {
  width: 7.5rem;
  height: 100vh;
  background: #ebebeb;
}   
div {
  font-size: 0.12rem;
}
img {
  width: 0.5rem;
  margin-left: 0.2rem;
}
.my-header {
  width: 7.5rem;
  height: 2rem;
  font-size: 0.2rem;
  margin-top: 1rem;
  background: #fff;
  padding-bottom: 0.5rem;
  text-align: center;
}
.my_dingdan {
  display: flex;
  width: 7.5rem;
  text-align: left;
  margin-top: 0.03rem;
  background: #fff;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  justify-content: space-around;
  div {
    width: 1rem;
  }
}
/deep/ .cell {
  margin-top: 0.2rem;
}
.cell_bottom{
    margin-top:.2rem;
}
.quit_login{
  margin-top:.02rem;
}
</style>
